Feature: Hide menu item if under a threshold#196
Conversation
1fdfefe to
c30fd06
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c30fd06f51
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
d8b6cc5 to
9aa9943
Compare
9aa9943 to
2911ef1
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2911ef14aa
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| private func scheduleLaunchVisibilityUpdate() { | ||
| self.launchVisibilityTask = Task { @MainActor in | ||
| try? await Task.sleep(for: .seconds(15)) | ||
| self.updateVisibility() |
There was a problem hiding this comment.
Enforce launch grace before applying threshold
The 15‑second “show on launch” grace isn’t actually enforced: scheduleLaunchVisibilityUpdate() only schedules another updateVisibility() call, but updateVisibility() still runs immediately from store/settings observation. Since UsageStore.init kicks off a refresh right away, a fast refresh can set a snapshot below the threshold and hide the status item well before 15 seconds. To guarantee the grace period, gate meetsThreshold/updateVisibility with a launch timestamp or a flag that suppresses threshold checks until the timer expires.
Useful? React with 👍 / 👎.
what
I usually hit a keyboard shortcut to open up CodexBar and check on whats going on - so having it in the Menu Bar all the time is a bit much. Unless I want to check (or am about to hit a limit) I don't really need to see the status item. So, might as well hide it?
other implicit behavior
I kept the status item showing on app launch for 15s to confirm the app opened - which, anecdotally, is just long enough for me to check on the status of things, tab away, and forget about things for a few minutes at a time.
visuals
While CodexBar is open to show details, the status item will also stay visible.
Video of CodexCode showing and hiding in response to the key combo
https://github.com/user-attachments/assets/09dd8096-2313-43b4-a209-36846eb865a6
There's a menubar animation when it shows and hides. Claude claims its from macOS, and I think that's true. But, It's a bit weird to see all the time. I did a quick pass of "what if I hide the view within the status item instead of the status item itself?" but that looked worse.
Here's a screenshot of the settings page to configure all this:

I'm not totally sold on this page - and happy to change anything based on feedback, but here's whats on my list of things that are questionable:
implementation notes
Although I had Claude do the first pass of things, there were enough "ehhhh…" that I spent some time talking it through most of the implementation to be a bit more idiomatic. Some examples of Opus falling short:
didSetof the data store instead of aBindingand clamping in asetuserDefaults.register(defaults:)existing without API docs being thrown at it (but to be fair… most people forget about this API as well 🙈)